package wsz.provider2.service;

import io.netty.channel.ChannelHandler;
import org.springframework.stereotype.Service;
import wsz.api.IUserService;
import wsz.pojo.User;
import wsz.rpc.provider.anno.RpcService;

import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.Map;

/**
 * @author wsz
 * @date 2021/12/1 16:45
 **/
@Service
@RpcService
@ChannelHandler.Sharable
public class UserServiceImpl implements IUserService {

    Map<Integer, User> userMap = new HashMap<>();

    @PostConstruct
    public void intUsers() {
        userMap.put(1, new User(1, "provider222：1"));
        userMap.put(2, new User(2, "provider222：2"));
        userMap.put(3, new User(3, "provider222：3"));
        userMap.put(4, new User(4, "provider222：4"));
    }


    @Override
    public User getById(int id) {
        return userMap.get(id);
    }
}
